pageNum = 1,
pageSize = 10

// 总积分，兑换积分
$.ajax({
    type: "GET",
    url: serverPort + `/ddApi/socialOb/getIntegralNum?openId=${openId}`,
    dataType: 'json',
    success: function (res) {
        var allCredit = res.data

        var allCreditDom = `
                <div>
                    <p>当前积分</p>
                    <p>${allCredit.currentIntegral}</p>
                </div>
                <div>
                    <p>已兑换</p>
                    <p>${allCredit.exchangeIntegral}</p>
                </div>
            `
        $('.jf-hd').append(allCreditDom)
    },
    error: function (res) {
        console.log(res)
    }
})


// 积分兑换情况，兑换时间
requireData()

function requireData() {
    $.ajax({
        type: "GET",
        url: serverPort + `/ddApi/socialOb/getIntegralList?openId=${openId}&pageNum=${pageNum}&pageSize=${pageSize}`,
        dataType: 'json',
        success: function (res) {
            var creditArr = []
            var creditJson = res.data

        console.log(res.data)

            //遍历json对象
            for (var val in creditJson) {

                creditArr.push(creditJson[val])

                for (var j = 0; j < creditArr.length; j++) {
                    var creditArrChild = creditArr[j]

                    var creditArrChildDom = `
                            <div class='item'>
                                <p>${val}</p>
                                <ul class='msg'></ul>
                            </div>
                        `

                    $('.jf-list').append(creditArrChildDom)


                    for (var k = 0; k < creditArrChild.length; k++) {

                        if (creditArrChild[k].channelType === 1) {

                            var creditLIstDom1 = `<li>
                                        <span>上传天气</span>
                                        <span>+ ${creditArrChild[k].integral}</span>
                                    </li>
                                    `
                            $('.jf-list .msg').append(creditLIstDom1)

                        } else if (creditArrChild[k].channelType === 2) {

                            var creditLIstDom2 = ` <li>
                                        <span>产品兑换</span>
                                        <span>- ${creditArrChild[k].integral}</span>
                                    </li>
                                    `
                            $('.jf-list .msg').append(creditLIstDom2)
                        }
                    }


                }
            }
        },
        error: function (res) {
            console.log(res)
        }
    })
}